	LIST      p=16f877a      	; List directive to define processor
	INCLUDE   "P16F877a.inc" 	; Processor specific variable definitions
	
	__CONFIG	_CP_OFF & _DEBUG_OFF & _LVP_OFF & _PWRTE_ON & _WDT_OFF & _BODEN_OFF & _HS_OSC 

; '__CONFIG' directive is used to embed configuration data within .asm file.
; The labels following the directive are located in the respective .inc file.
; See respective data sheet for additional information on configuration word.


;Main program:

	ORG	0			; Reset vector
	CALL	Init			; Setup hardware input/output

Loop	MOVLW	b'11111111'		; Move Count into W
	MOVWF	PORTD			; Write W to portb
	GOTO	Loop			
	
;Subroutines:
Init	
	CLRF	PORTD			; All of portb low
	BSF	STATUS, RP0		; Change to bank1
	CLRF	TRISD			; All of portb outputs
	BCF	STATUS, RP0		; Back to bank0
	RETURN

	END

		